Skip to content

feat: add Deque data structure with tests and README#2157

Merged
trekhleb merged 3 commits into
trekhleb:masterfrom
shahidansari311:feat/deque-data-structure
Jun 19, 2026
Merged

feat: add Deque data structure with tests and README#2157
trekhleb merged 3 commits into
trekhleb:masterfrom
shahidansari311:feat/deque-data-structure

Conversation

@shahidansari311

Copy link
Copy Markdown
Contributor

What this PR adds

A Deque (double-ended queue) data structure backed by the existing LinkedList.

Why it belongs here

The repo has Queue and Stack but no Deque. A Deque generalises both —
elements can be added/removed from either end in O(1) time.

Files added

  • src/data-structures/deque/Deque.js — implementation
  • src/data-structures/deque/__test__/Deque.test.js — 14 tests, 100% coverage
  • src/data-structures/deque/README.md — explanation, complexity table, use cases, references

Checklist

  • npm run lint passes (zero errors)
  • npm test passes (14/14 tests)
  • 100% code coverage
  • README includes Big O analysis and reference links
  • One PR for one data structure

@trekhleb trekhleb merged commit 6bb32ed into trekhleb:master Jun 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants